<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function fn() {
            var time = new Date();
            // console.dir(time);
            var year = time.getFullYear();
            console.log(year);
            var month = time.getMonth() + 1;
            var day = time.getDate();
            var hour = time.getHours();
            var minute = time.getMinutes();
            var second = time.getSeconds();
            var str = `现在时间是${year}年${month}月${day}日${hour}时${minute}分${second}秒`;
            // document.write(str);
            document.body.innerHTML = str;
        }

        // var str = "现在时间是"+year+"年"+month+"月"+day+"日"+ " "+ hour+"时"+minute+"分"+second+"秒";
        setInterval(function () {
            console.log("执行了");
            fn();
        }, 1000);


        // var str = "<div>"+
        //             "<span>123</span>"+
        //           "</div>";
        // var str = `<div>
        //               <span>123</span>
        //            </div>`;




    </script>
</body>

</html>